package com.oppo.userServer.application.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.oppo.userServer.application.converter.UserDTOConverter;
import com.oppo.userServer.application.dto.UserDTO;
import com.oppo.userServer.application.manager.UserManager;
import com.oppo.userServer.application.service.UserService;
import com.oppo.userServer.infrastructure.dataObject.UserDO;
import com.oppo.userServer.infrastructure.mapper.UserDOMapper;
import com.oppo.userServer.presentationO.vo.UserResultVO;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 清梦
 * @version 1.0.0
 * @Description
 * @createTime 2024年03月11日 22:48:00
 */
@Service
public class UserServiceImpl extends ServiceImpl<UserDOMapper, UserDO> implements UserService {
    /**
     * 获取用户列表
     *
     * @param userDTO 用户 DTO
     * @return {@link List }<{@link UserResultVO }>
     * @author qingmeng
     * @createTime: 2024/03/11 23:01:17
     */
    @Override
    public List<UserResultVO> getUserList(UserDTO userDTO) {
        LambdaQueryWrapper<UserDO> queryWrapper = UserManager.createWrapper(userDTO);
        List<UserDO> userDOList = baseMapper.selectList(queryWrapper);
        return UserDTOConverter.converterUserDOToResultVO(userDOList);
    }
}
